<%@ page import="java.util.Map" %><%--
  Created by IntelliJ IDEA.
  User: 13459
  Date: 2019/6/8
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>小米商城后台管理系统</title>
    <!-- plugins:css -->
    <link rel="stylesheet" href="vendors/iconfonts/mdi/css/materialdesignicons.min.css">
    <link rel="stylesheet" href="vendors/css/vendor.bundle.base.css">
    <!-- endinject -->
    <!-- inject:css -->
    <link rel="stylesheet" href="css/style.css">
    <!-- endinject -->
    <link rel="shortcut icon" href="images/logo.jpg" />
</head>
<body OnLoad="swapPic()">
<%
    Map<String,String> userName = (Map<String, String>) request.getSession().getAttribute("userName");
    String path = new String();
    String usename = new String();
    if(userName != null) {

        for(String key : userName.keySet()){
            String value = userName.get(key);
            if (key.equals("img"))
                path = value;
            if (key.equals("用户名"))
                usename = value;

        }
    }
    else{
%>
<script language='javascript'>document.location = 'http://localhost:8080/login.html '</script>
<%
    }
%>
<div class="container-scroller">
    <!-- partial:partials/_navbar.html -->
    <nav class="navbar default-layout-navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
        <div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
            <img src="images/logo.jpg">
            <!--a class="navbar-brand brand-logo-mini" href="index.html"><img src="images/logo-mini.svg" alt="logo"/></a-->
        </div>
        <div class="navbar-menu-wrapper d-flex align-items-stretch">

            <ul class="navbar-nav navbar-nav-right">
                <li class="nav-item nav-profile dropdown">
                    <a class="nav-link dropdown-toggle" id="profileDropdown" href="#" data-toggle="dropdown" aria-expanded="false">
                        <div class="nav-profile-img">
                            <!--头像根据登录的用户改 -->
                            <img src="images/faces/<%=path%>" alt="image">
                            <span class="availability-status online"></span>
                        </div>
                        <div class="nav-profile-text">
                            <!--名字根据登录的用户改 -->
                            <p class="mb-1 text-black">你好，<%=usename%></p>
                        </div>
                    </a>
                    <div class="dropdown-menu navbar-dropdown" aria-labelledby="profileDropdown">
                        <a class="dropdown-item" href="person_center.html">
                            <i class="mdi mdi-cached mr-2 text-success"></i>
                            个人中心
                        </a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="login.html">
                            <i class="mdi mdi-logout mr-2 text-primary"></i>
                            退出
                        </a>
                    </div>
                </li>
                <li class="nav-item d-none d-lg-block full-screen-link">
                    <a class="nav-link">
                        <i class="mdi mdi-fullscreen" id="fullscreen-button"></i>
                    </a>
                <li class="nav-item nav-logout d-none d-lg-block">
                    <a class="nav-link" href="login.html">
                        <i class="mdi mdi-power"></i>
                    </a>
                </li>
                </li>
            </ul>
            <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
                <span class="mdi mdi-menu"></span>
            </button>
        </div>
    </nav>
    <!-- partial -->
    <div class="container-fluid page-body-wrapper">
        <!-- partial:partials/_sidebar.html -->
        <nav class="sidebar sidebar-offcanvas" id="sidebar">
            <ul class="nav">
                <li class="nav-item nav-profile">
                    <a href="index.jsp" class="nav-link">
                        <div class="nav-profile-image">
                            <!--头像根据登录的用户改 -->
                            <img src="images/faces/<%=path%>" alt="profile">
                            <span class="login-status online"></span> <!--change to offline or busy as needed-->
                        </div>
                        <div class="nav-profile-text d-flex flex-column">
                            <!--名字角色根据登录的用户改 -->
                            <span class="font-weight-bold mb-2"><%=usename%></span>
                            <span class="text-secondary text-small">系统管理员</span>
                        </div>
                        <i class="mdi mdi-bookmark-check text-success nav-profile-badge"></i>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="index.jsp">
                        <span class="menu-title">首页</span>
                        <i class="mdi mdi-home menu-icon"></i>
                    </a>
                </li>

                <li class="nav-item">
                    <a class="nav-link" href="user_manage.jsp">
                        <span class="menu-title">用户管理</span>
                        <i class="mdi mdi-contacts menu-icon"></i>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="http://localhost:8080/goodmanageServlet">
                        <span class="menu-title">商品管理</span>
                        <i class="mdi mdi-format-list-bulleted menu-icon"></i>
                    </a>
                </li>


                <li class="nav-item">
                    <a class="nav-link" data-toggle="collapse" href="#ui-basic" aria-expanded="false" aria-controls="ui-basic">
                        <span class="menu-title">订单管理</span>
                        <i class="menu-arrow"></i>
                        <i class="mdi mdi-crosshairs-gps menu-icon"></i>
                    </a>
                    <div class="collapse" id="ui-basic">
                        <ul class="nav flex-column sub-menu">
                            <li class="nav-item"> <a class="nav-link" href="http://localhost:8080/order_manageServlet">订单内容</a></li>
                            <li class="nav-item"> <a class="nav-link" href="http://localhost:8080/order_deliveryServlet">订单配送</a></li>
                        </ul>
                    </div>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="http://localhost:8080/message_manageServlet">
                        <span class="menu-title">留言管理</span>
                        <i class="mdi mdi-table-large menu-icon"></i>
                    </a>
                </li>

                <li class="nav-item">
                    <a class="nav-link"  href="person_center.jsp">
                        <span class="menu-title">个人中心</span>
                        <i class="mdi mdi-medical-bag menu-icon"></i>
                    </a>
                </li>
            </ul>
        </nav>
        <!-- partial -->


        <script language="javascript" type="text/javascript">
            var ranl = 0;
            var useRand = 0;
            images = new Array;
            images[1] = new Image();
            images[1].src = "img/index1.jpg";
            images[2] = new Image();
            images[2].src = "img/index2.jpg";
            images[3] = new Image();
            images[3].src = "img/index3.jpg";
            images[4] = new Image();
            images[4].src = "img/index4.png";
            function swapPic()
            {
                var imgnum = images.length-1;
                do{
                    var randnum = Math.random();
                    randl = Math.round((imgnum-1)*randnum)+1;
                } while(randl==useRand);
                useRand = randl;
                document.randimg.src = images[useRand].src
                setTimeout('swapPic()',2000);
            }
        </script>
        <img name ="randimg" src="img/index1.jpg">



        <!-- main-panel ends -->
    </div>
    <!-- page-body-wrapper ends -->
</div>
<!-- container-scroller -->

<!-- plugins:js -->
<script src="vendors/js/vendor.bundle.base.js"></script>
<script src="vendors/js/vendor.bundle.addons.js"></script>
<!-- endinject -->
<!-- Plugin js for this page-->
<!-- End plugin js for this page-->
<!-- inject:js -->
<script src="js/off-canvas.js"></script>
<script src="js/misc.js"></script>
<!-- endinject -->
<!-- Custom js for this page-->
<script src="js/dashboard.js"></script>
<!-- End custom js for this page-->
</body>

</html>
